package com.qf.day02_springboot.controller;

import com.qf.day02_springboot.model.User;
import com.qf.day02_springboot.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * ---     天道酬勤      ---
 * --- 代码敲烂 月薪过万 ---
 *
 * @author LiuBoYan
 * @desc
 */

@Controller
public class LoginController {

    //注入LoginService
    @Autowired
    private LoginService loginService;

    @Autowired
    private User user;

    @GetMapping("/test")
    public String test(){

        //调用loginService的login方法
        //现在控制台需要打印出login方法的执行结果,以确保loginService的login方法被调用
        loginService.login();
        //修改User对象的id属性
        user.setId(888);
        //打印User对象的id和username属性
        System.out.println(user.getId());
        System.out.println(user.getUsername());
        return "ok.html";
    }

}
